package com.example.ch44;

import com.example.ch44.factorymethod.FileLoggerFactory;
import com.example.ch44.factorymethod.LoggerFactory;
import com.example.ch44.simplefactory.Logger;
import com.example.ch44.simplefactory.SimpleLoggerFactory;

public class Main {
    public static void main(String[] args) {
        {
            // 简单工厂
            Logger logger = SimpleLoggerFactory.getLogger("file");
            logger.log("test");
        }

        {
            // 工厂方法
            LoggerFactory factory = new FileLoggerFactory();
            com.example.ch44.factorymethod.Logger logger = factory.getLogger();
            logger.log("test2");
        }
    }
}